package com.feicheng.house.wcpay;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource(value = "classpath:wechatPayConfig.properties",encoding = "UTF-8")
public class wechatConfig implements InitializingBean {

    @Value("${gateway}")
    private String gateway;

    @Value("${appsecret}")
    private String appsecret;

    @Value("${mchid}")
    private String mchid;  //商户号

    @Value("${appid}")
    private String appid;

    @Value("${key}")
    private String key;

    @Value("${spbillCreateIp}")
    private String spbillCreateIp;

    @Value("${tradeType}")
    private String tradeType;

    @Value("${notifyUrl}")
    private String notifyUrl;

    @Value("${unifiedorderUrl}")
    private String unifiedorderUrl;

    @Value("${signType}")
    private String signType;

    public static String GATEWAY;
    public static String APP_SECRET;
    public static String MCH_ID;
    public static String APPID;
    public static String KEY;
    public static String SPBILL_CREATE_IP;
    public static String TRADE_TYPE;
    public static String NOTIFY_URL;
    public static String UNIFIEDORDER_URL;
    public static String SIGN_TYPE;


    @Override
    public void afterPropertiesSet() throws Exception {
        GATEWAY = gateway;
        APP_SECRET = appsecret;
        MCH_ID = mchid;
        APPID = appid;
        KEY = key;
        SPBILL_CREATE_IP = spbillCreateIp;
        TRADE_TYPE = tradeType;
        NOTIFY_URL = notifyUrl;
        UNIFIEDORDER_URL = unifiedorderUrl;
        SIGN_TYPE = signType;
    }
}
